import json
import requests
# class BaseMsgType():
#     def __init__(self,bot:int,msg:str):
#         self.dictData = dict()
#         self.dictData['bot']=bot
#         self.dictData['msg']=msg
#     def getJosn(self):
#         return json.dumps(self.dictData)
# class BaseSendType():
#     def __init__(self,MsgType):
#         self.header={'Content-Type':'application/json'}
#         self.MsgSend=MsgType.getJosn()
#         print(self.MsgSend)
#
# class FriendMsg(BaseMsgType):
#     def __init__(self,bot:int,msg:str,qq:int):
#         super().__init__(bot,msg)
#         self.dictData['qq']=qq
#         self.json=super().getJosn()
#
# class GroupMsg(BaseMsgType):
#     def __init__(self,bot:int,msg:str,group:int,anonymous:bool):
#         super().__init__(bot,msg)
#         self.dictData['group']=group
#         self.dictData['anonymous']=anonymous
#         self.json=super().getJosn()
#
# class FriendSend(BaseSendType):
#     def __init__(self,FriendMsg:FriendMsg):
#         super().__init__(FriendMsg)
#         self.json=FriendMsg.json
#     def sendMsg(self):
#         a=requests.post('http://129.174.211.83:53392/send_friend_msg',data=self.json,headers=self.header)
#         print(a.text)
#
# class GroupSend(BaseSendType):
#     def __init__(self,GroupMsg:GroupMsg):
#         super().__init__(GroupMsg)
#
class FriendApi():
    def __init__(self,bot:int,qq:int):
        self.header={'Content-Type':'application/json'}
        self.bot=bot
        self.qq=qq
    def sendWord(self,msg:str):
            data={
            "bot":self.bot,
            "qq": self.qq,
            "msg":msg,
                }
            js = json.dumps(data)
            result=requests.post('http://129.211.74.183:53392/send_friend_msg',data=js,headers=self.header)
class GroupApi():
    def __init__(self,bot:int,group:int):
        self.header={'Content-Type':'application/json'}
        self.bot=bot
        self.group=group
    def sendWord(self,msg:str,anonymous:bool=False):
            data={
            "bot":self.bot,
            "group": self.group,
            "msg":msg,
            "anonymous":anonymous
                }
            js = json.dumps(data)
            result=requests.post('http://129.211.74.183:53392/send_group_msg',data=js,headers=self.header)
            print(result.text)


